<!--
 * @description: 
 * @Author: vikingShip
 * @Date: 2021-11-04 14:20:04
 * @LastEditors: vikingShip
 * @LastEditTime: 2022-02-09 13:28:54
-->
<template>
  <home ref="Home" isCustom="true"></home>
</template>

<script lang="ts">
  import {
    Component,
    Vue
  } from "vue-property-decorator";
  import home from "../modules/home/home.vue";
import { getDecorationAll } from "@/api/modules/decoration";


  @Component({
    components: {
      home
    }
  })
  export default class custom extends Vue {
    

  // 页面周期函数--监听页面加载
  onLoad() {
    this.getDecorationAllList();
    this.$store.commit('settingStore/setHasInCustom',true);
  }

  async getDecorationAllList() {
    try {
      const res = await getDecorationAll();
      const data = res.data || res;
      const pages = data.pages;
      this.parseAssembleList(pages);
    } catch (e) {
      uni.showToast({
        title: `${e}`,
        icon: "none",
      });
    }
  }

  parseAssembleList(pageList) {
    let assembleList = [] as any;
    const nid = this.$store.state.settingStore.newCurrentPageId;
    assembleList = pageList.filter(item => Number(item.id) === Number(nid));
    uni.setNavigationBarTitle({
      title: `${assembleList[0].pageName}`,
    });
  }
}
</script>

<style></style>
